<template>
  <div>
    <ElDrawer v-model="visible"
      ><ElForm style="width: 300px">
        <ElFormItem label="审核意见：">
          <ElInput type="textarea" v-model="subexpauditDto.examinetext" />
        </ElFormItem>
        <ElFormItem label="是否同意：">
          <el-radio-group v-model="subexpauditDto.status" class="ml-4">
            <el-radio label="auditted" size="large">同意</el-radio>
            <el-radio label="repulse" size="large">不同意</el-radio>
          </el-radio-group>
        </ElFormItem>

        <ElButton type="primary" @click="audit()">确定</ElButton>
      </ElForm></ElDrawer
    >
  </div>
</template>
<script lang="ts">
/**
 * 页面核心数据结构体说明文档
 *
 *
 */
// import from
export type status = 'auditted' | 'repulse'
export default {
  name: 'SubEponseInsert',
  props: {
    sampleP: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      sampleD: 'value',
      visible: false,
      subexpauditDto: {
        examinetext: '同意',
        status: 'auditted' as status
      },
      code: ''
    }
  },
  computed: {
    /* sampleC() {
        return this.sampleD + "--";
      }, */
  },
  created() {},
  mounted() {},
  methods: {
    // sampleM() {},
    async audit() {
      console.log(this.subexpauditDto)
      console.log(this.code)
      await   axios({
              method: "PUT",
              url: "http://127.0.0.1:7001/subexponse/modify/audit/"+this.code,
              data: this.subexpauditDto,
            }).then(
              (res) => {
                console.log(res.data);
                this.visible=false
                this.$emit('putaudit')
              },
              (error) => {
                console.log(error.response.data);
              }
            );
    },
    time(date: Date) {
      const datec =
        date.getFullYear() +
        '年' +
        (date.getMonth() + 1) +
        '月' +
        date.getDate() +
        '日' +
        date.getHours() +
        '时' +
        date.getMinutes() +
        '分' +
        date.getSeconds() +
        '秒'
      //用法
      // <ElTableColumn> <template #default="{ row }">
      //     <span>{{ time(new Date(row.applytime)) }}</span>
      //   </template></ElTableColumn>
      return datec
    }
  },
  watch: {
    // sampleP(n, o) {},
  }
}
</script>

<!--<style scoped>-->
<style lang="scss" scoped></style>
